// 0-大块 1-小块 2-饼图 3-柱形图 4-折线 5-雷达 6-地图 7-折线（虚线）8-面积 9-环形  11-正负交错
export default {
  // 饼图
  "2": {
    type: "pie",
    radius: ['32%', '62%'],
    center: ['50%', '45%'],
    startAngle: 20,
    avoidLabelOverlap: true,
    minAngle: 5,
    itemStyle: {
      borderRadius: 4,
      borderColor: '#02081f',
      borderWidth: 2,
    },
    label: {
      show: true,
      width: 43,
      overflow: 'break',
      lineHeight: 13,
      fontSize: 11,
      color: '#fff',

      // formatter: `{b}\n{c}%`
    },
    emphasis: {
      label: {
        show: true,
        color: '#24E8FF',
        fontSize: 11,
      }
    },
    labelLine: {
      show: true,
      length: 12,
      length2: 3,
      smooth: true,
    },
  },
  // 柱状图 保费
  "3": {
    type: "bar",
    barWidth: "60%",
    barGap: '-100%',
    itemStyle: {
      borderRadius: [5, 5, 0, 0]
    },
    linearGradient: [
      0,
      0,
      0,
      1, [
        { offset: 0, color: "#54CDFF" },
        { offset: 1, color: "#1266FF" }
      ]
    ]
  },
  // 浅蓝线 增速
  "4": {
    type: "line",
    symbol: "none",
    color: "#5EF2FF",
    smooth: true,
    lineStyle: {
      width: 2
    }
  },
  // 雷达
  "5": {
    type: "radar"
  },
  // 地图
  "6": {
    type: "map"
  },
  // 目标线 红色虚线
  "7": {
    type: "line",
    symbol: "none",
    smooth: true,
    color: "#E84131",
    lineStyle: {
      width: 3,
      type: [3, 4]
    }
  },
  // 面积折线
  "8": {
    type: "line",
    symbol: "none",
    smooth: true,
    color: "#5EF2FF",
    lineStyle: {
      width: 2,
    },
    areaStyle: {
      color: {
        type: "linear",
        x: 0,
        y: 0,
        x2: 0,
        y2: 1,
        colorStops: [{
          offset: 0,
          color: "rgba(129, 227, 255, 0.8)" // 0% 处的颜色
        },
        {
          offset: 1,
          color: "rgba(129, 227, 255, 0.2)" // 100% 处的颜色
        }
        ],
        global: false // 缺省为 false
      }
    }
  },
  // 目标线 红色虚线
  "10": {
    type: "line",
    symbol: "none",
    smooth: true,
    color: "#E84131",
    lineStyle: {
      width: 3,
      type: [3, 4]
    }
  },
  // 正负条形图
  "11": {
    type: "bar",
    barGap: '-100%',
  },
  // 正负条形图
  "17": {
    type: "bar",
    barGap: '-100%',
    barMinHeight: 5,
  },
  // 堆叠图
  "18": {
    type: "bar",
  },
  // 垂直柱状图
  "19": {
    type: "bar",
    barMinHeight: 5,
  },
  tooltip1: {
    show: true,
    trigger: 'axis',
    backgroundColor: 'rgba(50,50,50,0.7)',
    borderColor: 'rgba(0,0,0,0)',
    axisPointer: {
      // type: 'shadow',
    },
    textStyle: {
      color: '#fff',
      fontSize: 10,
    },
    // formatter: 'Loading',
    padding: 5
  },
  tooltip2: {
    show: true,
    borderWidth: 0,
    trigger: 'item',
    backgroundColor: 'rgba(50,50,50,0.7)',
    borderColor: 'rgba(0,0,0,0)',
    axisPointer: {
      // type: 'shadow'
    },
    textStyle: {
      color: '#fff',
      fontSize: 10,
    },
    formatter: function (params) {
      var result = '';
      console.log(params, " params ");
      params.forEach(function (item) {
        result += item.seriesName + " : " + item.value + "</br>";
      });
      return result;
    },
    padding: 5
  },
  itemStyle: (idx) => {
    let color = [
      ['#FA8C09', '#FCDA15'],
      ['#006CFF', '#3081e5'],
      ['#EF2D2D', '#FF6161'],
      ['#0BD4D1', '#77BFFF'],
      ['#5D2FF4', '#6e799a'],
      ['#f45454', '#fbb57d'],
    ]
    idx = idx % color.length
    let itemStyle = {
      color: {
        type: 'linear',
        x: 0,
        y: 0,
        x2: 0,
        y2: 1,
        colorStops: [{
          offset: 0,
          color: color[idx][0] // 0% 处的颜色
        }, {
          offset: 1,
          color: color[idx][1] // 100% 处的颜色
        }],
        global: false // 缺省为 false
      }
    }
    return itemStyle
  },
  barStyle: (idx) => {
    let color = [
      ["rgb(18,102,255)", "rgb(18,102,255)"],
      // ["#54CDFF", "#1266FF"],
      ["#FFB07B", "#FFB07B"],
      // ['#FA8C09', '#FCDA15'],
      ['#EF2D2D', '#FF6161'],
      ['rgb(94,242,255)', 'rgb(94,242,255)'],
      ['#5D2FF4', '#6e799a'],
    ]
    idx = idx % color.length
    let linearGradient = [0, 0, 0, 1,
      [
        { offset: 0, color: color[idx][0] },
        { offset: 1, color: color[idx][1] }
      ]
    ]
    return linearGradient
  }
};